<?php

use Biz\service\trade\Cart as sCart;
use Biz\service\trade\UserAddress as sUserAddress;

/**
 * @deprecated
 */
class CartListAction extends ActionPlugin
{
    const USER_LEVEL = self::LEVEL_VISITOR;

    public function main()
    {
        $skuIds = $this->getRequest()->getQuery('sku_ids');

        $skuIds = explode(',', $skuIds);

        $skuIds = array_filter($skuIds, function ($v) {
            return !empty($v);
        });

        $provinceId = $this->getRequest()->getQuery('province_id', 0);
        $cityId = $this->getRequest()->getQuery('city_id', 0);

        $defaultCityId = sUserAddress::getUserDefaultCityCode($this->uid);
        $areaCode = $defaultCityId ? $defaultCityId : ($cityId ? $cityId : $provinceId);


        $data = sCart::cartList(($this->uid > 0) ? $this->uid : $this->vid, $skuIds, $areaCode, $this->appType);

        $this->setSuccess($data);

    }
}